Skip to content

任务栏歌词微调#979

Open
kazukokawagawa wants to merge 4 commits intodevfrom
dev-bar
Open

任务栏歌词微调#979
kazukokawagawa wants to merge 4 commits intodevfrom
dev-bar

Conversation

@kazukokawagawa
Copy link
Collaborator

No description provided.

- 在设置中新增“隐藏歌词”选项,允许用户仅显示歌曲名称和歌手。
- 更新任务栏配置接口以支持该功能,并设置默认值为 false。
- 修改任务栏歌词组件以根据用户设置决定是否显示歌词内容。
新增任务栏歌词强制重载按钮,用于修复显示异常问题。当任务栏歌词出现显示问题时,用户可通过设置中的"强制重载"按钮关闭并重新创建歌词窗口。
- 新增悬浮锁定模式开关,开启时鼠标穿透窗口,关闭时可拖动窗口
- 在任务栏歌词设置中添加锁定模式配置项
- 通过 IPC 通信实现前端与主进程的鼠标穿透状态同步
@kazukokawagawa kazukokawagawa self-assigned this Mar 6, 2026
Copilot AI review requested due to automatic review settings March 6, 2026 13:13
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求主要针对任务栏歌词功能进行了多项用户体验优化。通过引入浮动窗口的锁定模式,提升了交互的灵活性和便利性;新增的隐藏歌词选项,满足了用户对界面简洁性的需求;而强制重载功能则为解决潜在的显示问题提供了快速有效的解决方案,整体增强了任务栏歌词的可用性和稳定性。

Highlights

  • 任务栏歌词浮动窗口锁定模式: 为浮动模式的任务栏歌词窗口增加了“锁定模式”功能。开启后,鼠标将穿透歌词窗口,使其不阻挡下方操作;关闭后,用户可以拖动窗口进行位置调整。
  • 隐藏歌词内容选项: 新增了一个选项,允许用户隐藏任务栏歌词的实际歌词内容,仅显示歌曲的名称和歌手信息。
  • 强制重载歌词窗口: 在设置中添加了一个“强制重载”按钮,用于关闭并重新创建任务栏歌词窗口,以解决可能出现的显示异常问题。
Changelog
  • electron/main/ipc/ipc-taskbar.ts
    • 新增了处理鼠标穿透事件的IPC监听器。
    • 新增了处理强制重载歌词窗口事件的IPC监听器。
  • electron/main/utils/taskbar-lyric-manager.ts
    • 添加了 setMousePassthrough 方法,用于控制歌词窗口的鼠标事件穿透行为。
  • electron/main/windows/floating-taskbar-lyric-window.ts
    • 新增了 lastFloatingLock 属性来追踪浮动窗口的锁定状态。
    • 实现了 applyFloatingLock 方法,根据配置应用或解除浮动窗口的锁定状态。
    • 在窗口创建和布局更新时,集成了 applyFloatingLock 方法。
    • 添加了 setMousePassthrough 方法,用于直接设置窗口的鼠标事件穿透。
  • electron/main/windows/taskbar-lyric-window.ts
    • 添加了 setMousePassthrough 方法,用于设置窗口的鼠标事件穿透。
  • src/components/Setting/config/lyric.ts
    • 在歌词设置中新增了“锁定模式”开关,用于控制浮动歌词窗口的鼠标穿透。
    • 在歌词设置中新增了“隐藏歌词”开关,用于仅显示歌曲信息而不显示歌词内容。
    • 在歌词设置中新增了“强制重载”按钮,用于手动重载任务栏歌词窗口。
  • src/types/shared/taskbar-ipc.ts
    • TaskbarConfig 接口中新增了 floatingLock 属性,表示浮动窗口的锁定状态。
    • TaskbarConfig 接口中新增了 hideLyrics 属性,表示是否隐藏歌词内容。
    • 更新了 DEFAULT_TASKBAR_CONFIG,为 floatingLockhideLyrics 设置了默认值。
    • TASKBAR_IPC_CHANNELS 中新增了 FORCE_RELOAD 通道,用于强制重载歌词窗口。
  • src/views/TaskbarLyric/index.vue
    • 新增了 lastMousePassthrough 响应式变量来优化鼠标穿透状态的更新。
    • 添加了 setMousePassthrough 函数,通过IPC向主进程发送鼠标穿透指令。
    • 修改了 displayItems 计算属性,使其在 hideLyrics 开启时仅显示歌曲元数据。
    • 在组件挂载时,根据 floatingLock 配置初始化鼠标穿透状态,并监听其变化。
    • 为歌词容器样式添加了 position: relative
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 对“任务栏歌词/悬浮歌词”做了功能微调:新增悬浮窗口锁定(鼠标穿透)能力、支持隐藏歌词仅显示歌曲信息,并提供“强制重载窗口”用于修复显示异常。

Changes:

  • 新增悬浮锁定模式(鼠标穿透/不可拖动),并通过 IPC 下发到主进程窗口层生效
  • 新增“隐藏歌词,仅显示歌名和歌手”显示选项
  • 新增“强制重载”按钮与 IPC 通道,用于关闭并重新创建歌词窗口

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/views/TaskbarLyric/index.vue 渲染端支持 hideLyrics;悬浮模式下同步 floatingLock 到主进程以切换鼠标穿透
src/types/shared/taskbar-ipc.ts 扩展 TaskbarConfig(floatingLock/hideLyrics)与新增 FORCE_RELOAD IPC 常量
src/components/Setting/config/lyric.ts 设置项新增锁定模式、隐藏歌词、强制重载按钮
electron/main/windows/taskbar-lyric-window.ts 为任务栏歌词窗口补充 setMousePassthrough 以支持统一调用
electron/main/windows/floating-taskbar-lyric-window.ts 悬浮窗口根据 store 配置应用 floatingLock,并提供 setMousePassthrough
electron/main/utils/taskbar-lyric-manager.ts manager 增加 setMousePassthrough 透传到当前活动窗口
electron/main/ipc/ipc-taskbar.ts 新增 set-ignore-mouse-events 监听与 FORCE_RELOAD 重载逻辑

Comment on lines +111 to +120
// 强制重载歌词窗口
ipcMain.on(TASKBAR_IPC_CHANNELS.FORCE_RELOAD, () => {
const currentConfig = getTaskbarConfig();
if (!currentConfig.enabled) return;
taskbarLyricManager.close(false);
setTimeout(() => {
taskbarLyricManager.create(currentConfig.mode);
updateWindowVisibility(currentConfig);
}, 500);
});
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FORCE_RELOAD 通过 close(false) 后延时 500ms 再 create(),但两个 window 的 create() 都会在 win 尚未销毁时直接复用并 show() 现有窗口。这样在窗口关闭流程超过 500ms(或事件循环繁忙)时,可能无法真正“重载”窗口。建议在重建前明确等待旧窗口触发 closed/销毁(或在 close 时将引用置空/提供 destroy+recreate 的专用方法),以保证强制重载的确定性。

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This PR fine-tunes the taskbar lyric feature, adding lock mode, hide lyrics, and forced reload functionalities. However, critical security vulnerabilities were identified due to insecure Electron window configurations, which could lead to Remote Code Execution if a renderer is compromised. It is highly recommended to adopt Electron security best practices, such as disabling nodeIntegration, enabling contextIsolation, and using the sandbox for all renderer windows. Additionally, the code could benefit from improvements in redundancy and logical consistency.

Comment on lines +471 to +478
public setMousePassthrough(ignore: boolean) {
if (!this.win || this.win.isDestroyed()) return;
if (ignore) {
this.win.setIgnoreMouseEvents(true, { forward: true });
} else {
this.win.setIgnoreMouseEvents(false);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

setMousePassthrough 方法与 electron/main/windows/floating-taskbar-lyric-window.ts 文件中的实现完全相同。这造成了代码重复。为了提高代码的可维护性,建议可以考虑提取一个基类(例如 BaseTaskbarLyricWindow)来包含这些共享的方法。

value: computed({
get: () => taskbarLyricConfig.floatingLock,
set: (v) => {
taskbarLyricConfig.floatingLock = v ?? true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这里的默认值不一致。在 DEFAULT_TASKBAR_CONFIG 中,floatingLock 的默认值是 false。然而,这里的 setter 在 vnullundefined 时回退到了 true。这与另一个新设置 hideLyricsv ?? false 行为不一致,后者与其默认值 false 保持了一致。为了保持代码的一致性,建议将 v ?? true 修改为 v ?? false

Suggested change
taskbarLyricConfig.floatingLock = v ?? true;
taskbarLyricConfig.floatingLock = v ?? false;

Comment on lines +578 to +583
setMousePassthrough(taskbarConfig.floatingLock);
watch(
() => taskbarConfig.floatingLock,
(v) => setMousePassthrough(v),
{ immediate: true },
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

setMousePassthrough 的调用是多余的。由于 watch 配置了 { immediate: true }setMousePassthrough 会在侦听器创建时立即用初始值调用一次。因此,watch 前面的 setMousePassthrough(taskbarConfig.floatingLock); 调用是多余的,可以安全地移除。

    watch(
      () => taskbarConfig.floatingLock,
      (v) => setMousePassthrough(v),
      { immediate: true },
    );

margin: 5px 0;
padding: 0 0.9em;
box-sizing: border-box;
position: relative;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这个 position: relative 属性似乎是多余的。在其子元素中,需要绝对定位的元素(如 .cover 或歌词动画项)已经被包裹在设置了 position: relative 的容器中(例如 .cover-wrapper, .content, .lyric-list-wrapper)。因此,在顶层元素 .taskbar-lyric 上添加此属性显得多余。如果它没有特殊用途,建议移除以保持 CSS 的整洁。

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants